import { createApp } from 'vue'
// import './style.scss'
import App from './App.vue'
// 导入Element Plus和样式
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// 导入Element Plus中文语言包
import zhCn from 'element-plus/es/locale/lang/zh-cn'
// 导入Element Plus图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// 导入路由
import router from './router'
//导入pinia
import { createPinia } from 'pinia'
//import{piniaPersistedState} from 'pinia-plugin-persistedstate'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

const pinia = createPinia()
//const persist = piniaPersistedState()
// 使用持久化插件
pinia.use(piniaPluginPersistedstate)

const app = createApp(App)
//pinia.use(persist)
// 注册pinia
app.use(pinia)
// 注册Element Plus并配置中文
app.use(ElementPlus, {
  locale: zhCn,
})
// 注册路由
app.use(router)
// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.mount('#app')
